#include "comment.h"
#include "ui_comment.h"
#include <QDebug>
#include <QVBoxLayout>
#include <QSqlError>
comment::comment(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::comment)
{
    ui->setupUi(this);

    //设置QLabel自动换行属性
    ui->label_SetComment->setWordWrap(true);

}

comment::~comment()
{
    delete ui;
}

void comment::on_pb_SetComment_clicked()
{
    QSqlQuery query(db);//语句执行对象
    query.prepare("select comment from StuInfo where id = '1' ");
    if(query.exec() == false)
    {
        qDebug()<<db.lastError()<<endl;
        return;
    }
    QString result;
    while(query.next())
    {
        result +=query.value(0).toString()+    "\n";
    }
    ui->label_SetComment->setText(result);
}

//void comment::handleButtonClick()
//{
//    on_pb_SetComment_clicked();

//}


